  {% include "header.html" %}
  <script type="text/javascript" >
    var agency_id = "{{ agency_id }}";
    var route_type = "{{ route_type }}";
  </script>
  <h1>Fare Rule List <a href="http://code.google.com/transit/spec/transit_feed_specification.html#routes_txt___Field_Definitions">Refer</a></h1>
  {% if prompt %}
  <p id="prompt">{{ prompt }}</p>
  {% endif %}
  <div id="editor">
    <form method="POST" action="{{ url }}" id="editorform">
      <table>
        <tr>
          <th>Items</th>
          <th>Values</th>
        </tr>
        <tr>
          <td>ID</td>
          <td><input name = "fare_id" id = "fare_id" type="TEXT" value="{{ farerule.id }}"/></td>
        </tr>
        <tr>
          <td>Route ID</td>
          <td>
          <select name = "route_id" id = "route_id">
          {% for route in routes %}
             {% if route.id == route_id %}
             <option value="{{route.id}}" selected>{{route.id}}:{{route.longName}}({{route.shortName}})</option>
             {% else %}
             <option value="{{route.id}}">{{route.id}}:{{route.longName}}({{route.shortName}})</option>
             {% endif %}
          {% endfor %}
          </select>          
          </td>
        </tr>
        <tr>
          <td>Origin ID</td>
          <td><input name = "origin_id" type="text" value="{{ farerule.origin_id }}"/></td>
        </tr>
        <tr>
          <td>Destination ID</td>
          <td><input name = "destination_id" type="text" value="{{ farerule.destination_id }}"/></td>
        </tr>
        <tr>
          <td>Contains ID</td>
          <td><input name = "contains_id" type="text" value="{{ farerule.contains_id }}"/></td>
        </tr>
        <tr>
          <td colspan="2">
            <input type="submit" id = "submit" value="{{ submit }}" name = "submit" />
          </td>
        </tr>
      </table>
  </form>


</div>
<div class="sort">
  <form method="POST" action="" name="search">
    <input type="text" value=""/> <input type="submit" value="Search"/>
  </form>


</div>
    <div class="pager">
      paging info: [<a href="#">1</a>] [<a href="#">2</a>] ... [<a href="#">last</a>] <input type="text" value="" size="4" maxlength="4"/> <input type="submit" value="Go" />
    </div>
    <table>
      <tr>
    <th>&nbsp;</th>
    <th>ID</th>
    <th>Route ID</th>
    <th>Origin ID</th>
    <th>Destination ID</th>
    <th>Contains ID</th>
    <th>Action</th>
      </tr>
      {% for farerule in farerules %}
      <tr>
        <td><input type="checkbox" name="deleteid" value="{{farerule.id}}"/></td>
        <td>{{farerule.id}}</td>
        <td>{{farerule.route_id}}</td>
        <td>{{farerule.origin_id}}</td>
        <td>{{farerule.destination_id}}</td>
        <td>{{farerule.contains_id}}</td>
        <td>
          <a href="/admin/farerule?act=edit&id={{farerule.id}}&route_id={{farerule.route_id}}">Edit</a>&nbsp;
          <a href="/admin/farerule?act=delete&id={{farerule.id}}&route_id={{farerule.route_id}}">Delete</a>
        </td>
      </tr>
      {% endfor %}
    </table>
    <div class="pager">
      [<a href="#">1</a>] [<a href="#">2</a>] ... [<a href="#">last</a>] <input type="text" value="" size="4" maxlength="4"/> <input type="submit" value="Go" />
    </div>
    <div class="control">
      <input type="submit" value="Delete All"/>
    </div>
  </body>
</html>
